<template>
  <div>
    <Spin :spinning="loading" tip="Loading...">
      <div style="padding-top: 1rem;"></div>
      <!-- table -->
      <FormPanel ref="formPanel" :list="formList1" :cols="3" :formType="'add'" labelWidth="110" :isSubmitBtn="false"  />
      <div style="padding-top: 1rem;"></div>
    </Spin>
    <el-button type="primary" @click="saveDialog(1)">保 存</el-button>

    <el-button @click="closeDialog">关 闭</el-button>
  </div>
</template>
<script>
import {dictionary} from'@/utils/dictMixin';
import { getDetail, matchingSapCustomerNo,traverse,overrule} from '@/api/omSaleP/BigOrderRefund/AreaBigOrderRefundAudit/index.js';
import { isEmpty } from '@/utils/utils';
import { getThreeInfoList, newSave } from '@/api/repair/threePacksOfManager/warningParameterManagementCDuan';
export default {
  mixins: [dictionary],
  components: {

  },
  props: {
    rowData: {
      type: Object,
    },
    types: {
      type: Number,
      required: true
    },
  },
  data() {
    return {
      loading: false,
      dataList1: [],
      visible: false,
      visibleDrawer: false,
      collapse: false,
      rowDate: {},
      infoId: null,
      flterValue: {}, //参数
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      formList1: this.createFormList1(),
      saveData: null,
    };
  },
  methods: {
    createFormList1() {
      return [
        {
          type: 'TEXT_AREA',
          label: '审核意见',
          selfCols: 3 ,
          rows:10,
          disabled: false,// 只读
          readonly: false,// 只读
          fieldName: 'areaAuditOpinion',
          rules: [{ required: true, message: '规则名称...', trigger: 'blur' }],
        }
      ];
    },
    async saveDialog(type) {

      let [err,data] = await this.$refs.formPanel.GET_FORM_DATA();
      data = Object.assign({},this.rowData,data);

      console.log(data);
       if (err)return;
       if (this.types == 1) {
         console.log("bcaksjkaabk"+data)
         data.type=this.types;
        let res = await traverse(data);

        if (res.resultCode == 200) {
          this.$notify.success({title: '提示信息', message: '审核通过提交成功!'});
          this.$emit('save', {type: 'refresh'});
        }
      } else if (this.types == 2) {
         data.type=this.types;
         let res = await overrule(data);
         console.log("bcaksjkaabk"+data)
        if (res.resultCode == 200) {
          this.$notify.success({title: '提示信息', message: '驳回提交成功!'});
          this.$emit('save', {type: 'refresh'});
        }
      }
    },
    closeDialog() {
      this.$emit('close', {visible: false, data: this.selectedRows, type: 'close'});
    }
  }
};
</script>

<style lang="less" scoped></style>
